package com.esteel.settlement.config.validator;

import javax.validation.Validation;
import javax.validation.Validator;

import org.hibernate.validator.HibernateValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置接口配置类的验证类
 * @author zhangxiuzhi
 *
 */
@Configuration
public class ValidatorConfig {

	/**
	 * 报文数据的验证程序
	 * @return
	 */
	@Bean
	public Validator validator(){
		Validator validator = Validation.byProvider( HibernateValidator.class )
		        .configure()
		        .failFast( true )
		        .buildValidatorFactory()
		        .getValidator();
		return validator;
	}
	
	@Bean
	public PacketValidator packetValidator(){
		return new PacketValidator();
	}
	
	
}
